<?php
/**
 * 公告表单数据存入数据库中
 */
include "../util/DBUtil.php";
include "../util/PromptAction.php";

$id = $_POST['id'];
$title = $_POST['title'];
$content = $_POST['content'];
date_default_timezone_set("PRC");
$date = date('Y-m-d');

$db = new  DBUtil();
if ($id == "") {//添加
    $sql = "insert into tb_announcement(title,content,date) values (?,?,?)";
    $params = array($title, $content, $date);
} else {//修改
    $sql = "update tb_announcement set title=?,content=?,date=? where id=? ";
    $params = array($title, $content, $date, $id);
}
$statue = $db->update($sql, $params);
showStatue($statue);
echo "<script>window.open('../view/announ_info.php','info')</script>";

